

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>登录 - bat-leaf</title>
  <meta content="webkit" name="renderer">
  <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
  <meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
  <link href="../../layuiadmin/layui/css/layui.css" media="all" rel="stylesheet">
  <link href="../../layuiadmin/style/admin.css" media="all" rel="stylesheet">
  <link href="../../layuiadmin/style/login.css" media="all" rel="stylesheet">
</head>
<body>

  <div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;">

    <div class="layadmin-user-login-main">
      <div class="layadmin-user-login-box layadmin-user-login-header">
        <h2>peppa-leaf</h2>
        <p>There are no two identical leaves in the world.</p>
        <p>世界上没有两片完全相同的树叶。</p>
        <p> — 莱布尼茨</p>
      </div>
      <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
        <div class="layui-form-item">
          <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-username"></label>
          <input class="layui-input" id="LAY-user-login-username" lay-verify="required" name="username" placeholder="用户名" type="text">
        </div>
        <div class="layui-form-item">
          <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password"></label>
          <input class="layui-input" id="LAY-user-login-password" lay-verify="required" name="password" placeholder="密码" type="password">
        </div>

        <div class="layui-form-item">
          <button class="layui-btn layui-btn-fluid" lay-filter="LAY-user-login-submit" lay-submit>登 入</button>
        </div>
      </div>
    </div>

  </div>

  <script src="../../layuiadmin/layui/layui.js"></script>  
  <script>
  layui.config({
    base: '../../layuiadmin/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'user'], function(){
    var $ = layui.$
    ,setter = layui.setter
    ,admin = layui.admin
    ,form = layui.form
    ,router = layui.router()
    ,search = router.search;

    form.render();

    //提交
    form.on('submit(LAY-user-login-submit)', function(obj){
      $.ajax({
        url:"/login",
        type:"GET",
        data: obj.field,
        contentType: 'application/json',
        success:function(obj){
          location.href = '/static/views/index.html'
        },
        error:function(obj){
          layer.msg(obj.responseJSON.message)
        }
      });

    });

  });
  </script>
</body>
</html>